#ifndef __AFFAIR__
#define __AFFAIR__
#include <my_header.h>
#include "path_stack.h"
#define FULLPATH_SIZE 2048

typedef enum {
    CMD_UNKNOWN, // 未知命令的默认值
    CMD_CD,     // 对应 "cd"
    CMD_LS,     // 对应 "ls"
    CMD_PWD,    // 对应 "pwd"
    CMD_PUTS,   // 避免与标准库冲突，改为 "puts_cmd"
    CMD_GETS,   // 避免与标准库冲突，改为 "gets_cmd"
    CMD_RM,
    CMD_MKDIR,
    CMD_RMDIR,
    CMD_EXIT,
    RESPONSE
} CommandType;

typedef struct UsrInfo_s{
    char usr_name[32];
    pathStack_t pathStack;
    char *prefixPath;
}UsrInfo_t;

typedef struct train_s{
    int type;
    int length;
    char value[1000];
}train_t;

int UsrInfoInit(UsrInfo_t *pUsrInfo);
int cmd_cd(UsrInfo_t *pUsrInfo, char *path);
int cmd_ls(UsrInfo_t *pUsrInfo, char *list, int list_size);
int cmd_pwd(UsrInfo_t *pUsrInfo, char *pwd, int pwd_size);
int new_cmd_pwd(UsrInfo_t *pUsrInfo, char *pwd);
int cmd_puts(char *fileName,UsrInfo_t *user, int netfd);
int cmd_gets(char *fileName,UsrInfo_t* user, int netfd);
int cmd_rm(UsrInfo_t pUsrInfo, const char *fileName);
int cmd_mkdir(UsrInfo_t pUsrInfo, const char *dirName);
int cmd_rmdir(UsrInfo_t pUsrInfo, const char *dirName);
int get_abs_path(UsrInfo_t UsrInfo, char *path_buf, int buf_size);

#endif
